package zhtt.ehcache.repository;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import zhtt.ehcache.domain.User;

import java.util.List;

/**
 * Created by ztt on 2018/4/29.
 */
public interface UserRepository {

    long count();

    @Cacheable("userCache")
    User findOne(int id);


    @CachePut(value="userCache", key="#result.id")
    User save(User user);

    User findByName(User user);

    @CacheEvict(value="userCache",condition="")
    void delete(int id);

    List<User> findAll();
}
